Pseudorandom numbers have many applications in communications, testing, and radar systems. Pseudorandom numbers are usually generated as a sequence of numbers. When generating pseudorandom numbers, it is desirable that each pseudorandom number is maximal (random and doesn't repeat often) and uniform, (each number in the sequence occurs with the same probability).
A linear feedback shift register (LFSR) can be used for generating pseudorandom number sequences. The typical LFSR is a serial shift register that uses feedback taps, such as exclusive-or gates, at one or more of the memory cells to generate the pseudorandom states. If the LFSR is initialized in a non-zero state, it cycles through a sequence of states and eventually returns to its initial state. The sequence can be varied by changing the feedback taps, or by using a different seed value.
One problem that can occur with an LFSR is when the LFSR does not run its full sequence. Over the entire length of the sequence of the LFSR, the distribution will be uniform as all values will eventually occur. However, for a shorter subsequence, the codes generated can lack uniformity. Long strings of 0's or 1's can occur in a subsequence of less than the maximal sequence, causing non-uniformity. For example, a three bit LFSR can be used to pseudo-randomly generate two numbers [0,1] by taking the value of the least significant bit. For the full eight number sequence, zero will appear four times, and one will appear four times. However, for less than the full sequence, e.g. a six number subsequence, it is possible that either value (0 or 1) can appear twice as often as the other, depending on the seed used.
Another problem with using an LFSR is that a value produced by an LSFR cannot be used directly when the modulo is not a power of 2. This is because there will be values produced by the LFSR that are not to be included in the sequence. For example, if it is desired to generate a three number sequence, a two bit, or larger, LFSR can be used. However, the two-bit LFSR has four possible values; therefore, there can be a value generated in the sequence that cannot be used.